//
//  Array+ZMExtension.swift
//  zhonglibang
//
//  Created by Rowling on 2021/1/19.
//

import UIKit

extension Array : ZMCompatible {}

extension ZM where Base == Array<Dictionary<String, Any>> {
    func toJson() -> String {
        if (!JSONSerialization.isValidJSONObject(base)) {
            print("无法解析出JSONString")
            return ""
        }
        let data : NSData! = try? JSONSerialization.data(withJSONObject: base, options: []) as NSData?
        let JSONString = NSString(data:data as Data,encoding: String.Encoding.utf8.rawValue)
        return JSONString! as String
    }
}

